home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++ FAQ Reference 1.0 / C++ FAQ Reference 1.0.rsrc / TEXT_731.txt < prev    next >
Encoding:
Text File  |  1993-06-30  |  413 b   |  1 lines

  1. Because realloc() does *bitwise* copies (when it has to copy), which will tear most C++ objects to shreds.  C++ objects know how to copy themselves. They use their own copy constructor or assignment operator (depending on whether we're copying into a previously unused space [copy-ctor] or a previous object [assignment op]).  Moral: never use realloc() on objects of a class.  Let the class copy its own objects.